#include<stdio.h>
#include"queue.h"

int main(void){
	Queue line;
	Item tmp;
	char ch;
	
	InitQ(&line);
	puts("Testing the Queue interface.Type a to add a value,");
	puts("type d to delete a value, and type q to quit.");
	while( (ch=getchar())!='q'){
		if(ch != 'a' && ch !='d')continue;
		if(ch=='a'){
			printf("Integer to add:");
			scanf("%d", &tmp);
			if(!QFull(&line)){
				printf("Putting %d into queue.\n", tmp);
				EnQ(tmp, &line);
			}
			else puts("Queue is full");
		}
		else{

			if(QEmpty(&line)) puts("Nothing to delete!");
			else{
				DeQ(&tmp, &line);
				printf("Removing %d from queue\n", tmp);
			}
		}
		printf("%d items in queue\n", QItemCount(&line));
		puts("Type a to add, d to delete, q to quit:");
	}
	FreeQ(&line);
	puts("Bye!");
	return 0;
}
